﻿using PanhuaWin.系统管理;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PanhuaWin.通用
{
    public partial class Form修改密码 : UIForm
    {
        public Form修改密码()
        {
            InitializeComponent();
        }

        public string 条码 { get; internal set; }

        private void uiButton确认_Click(object sender, EventArgs e)
        {
            string Sys_User_modifyPwd_Url = pub.Sys_User_modifyPwd_Url;

            if (this.uiTextBox原密码.Text.Trim() == "")
            {
                MessageBox.Show("原密码不能为空", "修改失败", MessageBoxButtons.OK);


                return;
            }
            if (this.uiTextBox新密码.Text.Trim() == "")
            {
                MessageBox.Show("新密码不能为空", "修改失败", MessageBoxButtons.OK);


                return;
            }
            if (this.uiTextBox新密码.Text.Trim() != this.uiTextBox确认密码.Text.Trim())
            {
                MessageBox.Show("新密码两个必须一样", "修改失败", MessageBoxButtons.OK);


                return;
            }
            string oldPwd = this.uiTextBox原密码.Text.Trim();
            string newPwd = this.uiTextBox新密码.Text.Trim();

            string s = pub.HttpPost(Sys_User_modifyPwd_Url + "?oldPwd=" + oldPwd + "&newPwd=" + newPwd);
            ModifyPwdResult modifyPwdResult = new ModifyPwdResult();
            modifyPwdResult = Json.Deserialize<ModifyPwdResult>(s);
            if (modifyPwdResult.status == "True")
            {
                MessageBox.Show("密码修改成功", "修改成功", MessageBoxButtons.OK);



            }
            else
            {
                MessageBox.Show(modifyPwdResult.message, "修改失败", MessageBoxButtons.OK);
            }

        }
    }
}
